package main

import "fmt"

type unit8 int

func main() {
	/*var a int = 21
	var b int = 10
	var c int

	c = a + b
	fmt.Printf("第一行c的值为%d\n", c)
	c = a - b
	fmt.Printf("第二行c的值为%d\n", c)
	c = a * b
	fmt.Printf("第三行c的值为%d\n", c)
	c = a / b
	fmt.Printf("第四行c的值为%d\n", c)
	c = a % b
	fmt.Printf("第五行c的值为%d\n", c)
	a++
	fmt.Printf("第六行a的值为%d\n", a)
	a = 21
	a--
	fmt.Printf("第七行a的值为%d\n", a)*/

	/*var a int = 21
	var b int = 10
	if (a == b) {
		fmt.Printf("第一行a等于b\n")
	} else {
		fmt.Printf("第一行a不等于b\n")
	}
	if (a < b) {
		fmt.Printf("第二行a小于b\n")
	} else {
		fmt.Printf("第二行a不小于b\n")
	}
	if (a > b) {
		fmt.Printf("第三行a大于b\n")
	} else {
		fmt.Printf("第三行a不大于b\n")
	}

	a = 5
	b = 20
	if (a <= b) {
		fmt.Printf("第四行a小于等于b\n")
	}
	if (b >= a) {
		fmt.Printf("第五行b大于等于a\n")
	}*/

	/*var a bool = true
	var b bool = false
	if (a && b) {
		fmt.Printf("第一行条件为true\n")
	}
	if (a || b) {
		fmt.Printf("第二行条件为true\n")
	}
	//修改a和b的值
	a = false
	b = true
	if (a && b) {
		fmt.Printf("第三行条件为true\n")
	} else {
		fmt.Printf("第三行条件为false\n")
	}
	if (!(a && b)) {
		fmt.Printf("第四行条件为true\n")
	}*/

	/*var a unit8 = 60
	var b unit8 = 13
	var c unit8 = 0

	c = a & b
	fmt.Printf("第一行c的值为%d\n", c)
	c = a | b
	fmt.Printf("第二行c的值为%d\n", c)
	c = a ^ b
	fmt.Printf("第三行c的值为%d\n", c)
	c = a << 2
	fmt.Printf("第四行c的值为%d\n", c)
	c = a >> 2
	fmt.Printf("第五行c的值为%d\n", c)*/

	/*var a int = 21
	var c int

	c = a
	fmt.Printf("第一行=运算符实例，c值为 = %d\n", c)
	c += a
	fmt.Printf("第二行+=运算符实例，c值为 = %d\n", c)
	c -= a
	fmt.Printf("第三行-=运算符实例，c值为 = %d\n", c)
	c *= a
	fmt.Printf("第四行*=运算符实例，c值为 = %d\n", c)
	c /= a
	fmt.Printf("第五行/=运算符实例，c值为 = %d\n", c)
	c = 200
	c <<= 2
	fmt.Printf("第六行<<=运算符实例，c值为 = %d\n", c)
	c >>= 2
	fmt.Printf("第七行>>=运算符实例，c值为 = %d\n", c)
	c &= 2
	fmt.Printf("第八行&=运算符实例，c值为 = %d\n", c)
	c ^= 2
	fmt.Printf("第九行^=运算符实例，c值为 = %d\n", c)
	c |= 2
	fmt.Printf("第十行|=运算符实例，c值为 = %d\n", c)*/

	/*var a int = 4
	var b int32
	var c float32
	var ptr *int
	//运算符实例
	fmt.Printf("第一行a变量类型为 = %T\n", a)
	fmt.Printf("第二行b变量类型为 = %T\n", b)
	fmt.Printf("第三行c变量类型为 = %T\n", c)
	// &和*运算符实例
	ptr = &a // ptr包含了a变量的地址
	fmt.Printf("a的值为%d\n", a)
	fmt.Printf("*ptr为%d\n", *ptr)*/

	var a int = 20
	var b int = 10
	var c int = 15
	var d int = 5
	var e int
	e = (a + b) * c / d
	fmt.Printf("(a + b) * c / d的值为：%d\n", e)
	e = ((a + b) * c) / d
	fmt.Printf("((a + b) * c) / d的值为：%d\n", e)
	e = (a + b) * (c / d)
	fmt.Printf("(a + b) * (c / d)的值为：%d\n", e)
	e = a + (b * c) / d
	fmt.Printf("a + (b * c) / d的值为：%d\n", e)

}
